﻿// <copyright file="DirectorWrapper.cs" company="City of Portland, BES-ASM">
// </copyright>
// <summary>DirectorWrapper class</summary>

namespace BESASM.EMGAATS.UI
{
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using BESASM.EMGAATS.BusinessClasses;

  /// <summary>
  /// A class for wrapping a director for use in a ListBox control
  /// </summary>
  internal class DirectorWrapper
  {
    private IDirector internalDirector;

    /// <summary>
    /// Initializes a new instance of the <see cref="DirectorWrapper"/> class.
    /// </summary>
    /// <param name="director">The director to be wrapped.</param>
    public DirectorWrapper(IDirector director)
    {
      this.internalDirector = director;
    }

    /// <summary>
    /// Gets the name to use for display of the director in a ListBox.
    /// </summary>
    public string DisplayName
    {
      get
      {
        if (this.internalDirector == null)
        {
          return "<Null>";
        }
        else
        {
          string node = "<Null>";
          if (this.internalDirector.ToNode != null)
          {
            node = this.internalDirector.ToNode.NodeName;
          }

          return string.Format("{0} ({2} sq ft) - {1}", this.internalDirector.DirectorType, node, this.internalDirector.AreaSqFt);
        }
      }
    }

    /// <summary>
    /// Gets the director wrapped by this instance.
    /// </summary>
    public IDirector Director
    {
      get
      {
        return this.internalDirector;
      }
    }
  }
}
